Repository navigation
chore(ci): run the Playwright E2E suite as three parallel shards - #120
Merged
Merged
Conversation
Every workflow that runs on pull requests gets a concurrency group keyed on the PR number, with cancel-in-progress. Other events (push, tag, schedule, manual) key on the run id, so they never cancel or queue behind each other. Refs #115
The merged commit already passed both suites on its pull request. A push to main now runs only the fast gates (PHPStan, ts-check, API contract, plugin build). PHPUnit and the Playwright E2E suite run on pull requests, every night on main, and on demand. Refs #115
Fixture::reset() runs before every test and re-seeded the admin row with a fresh password_hash(). bcrypt costs 12 by default since PHP 8.4, about 0.22 s a hash, so ~1,770 resets spent most of the PHPUnit run hashing the same password. The hash is now computed once per process. BansTest (80 tests) locally: 24 s -> 8 s, same assertions. Refs #115
Fixture::reset() truncates and re-seeds every table before each test, so the job was bound by fsync. MariaDB now starts from a step (a service container cannot pass server options) with its datadir on tmpfs, innodb_flush_log_at_trx_commit=0, no doublewrite buffer and no binlog. It boots while PHP and Composer install, listens on a free loopback port, has a per-run name, and is removed when the job ends, so a self-hosted runner keeps no leftover container. BansTest (80 tests) locally: 43-49 s on disk -> 8-9 s on tmpfs. Refs #115
The suite ran on one worker because every spec shares the sourcebans_e2e database. Each shard now brings up its own dev stack and database and runs --shard=N/3, so workers: 1 no longer sets the total time. From the per-test durations of the PR #114 run (428 s of tests), the three contiguous slices carry 158 / 132 / 138 s. fail-fast is off, so a red run still lists every failing spec, and on failure a report job merges the shards' blob reports into the usual playwright-report artifact. Refs #115
Hashing once per process still cost 0.22 s in every #[RunInSeparateProcess] child (165 tests) and on every E2E reset, which runs in a fresh process. The fixture now seeds a precomputed cost-12 bcrypt hash of 'admin': same password, cost and format, and password_needs_rehash() stays false. Refs #115
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The E2E job runs 780 tests on one worker (
workers: 1, because every spec shares thesourcebans_e2edatabase), so it took 586 s on the PR #114 run, 477 s of it inRun E2E(#115).Change
e2e.yml: a matrixshard: [1, 2, 3]withfail-fast: false. Each job brings up its own dev stack (so its ownsourcebans_e2e) and runs./sbpp.sh e2e --shard=N/3 --reporter=blob,list.workers: 1inside each stack does not change.blob-report-Nandplaywright-test-results-N, and areportjob (if: failure(), so no wall time on a green run) merges the blob reports into the usualplaywright-reportHTML artifact.chromium,mobile-chromium), sameretries: 1+failOnFlakyTests.Checked
npx playwright test --list --shard=N/3locally: 260 + 260 + 260 = 780, the same as the unsharded--list(780 tests in 96 files).actionlint: no finding.Running 260 tests using 1 worker, shard N of 3in each job; 188 + 101 + 140 = 429 passed, 72 + 159 + 120 = 351 skipped, the same totals as the single job on fix(web): restore the system log search and fix the message filter #114 (429 / 351).Bring up the dev stack120-128 s (the image build, cut by chore(ci): build the E2E dev image with the GitHub Actions cache #122),Run E2E207-233 s.strategy.job-total, so a fork with one runner can setshard: [1].reportjob (it only runs after a failure).Version
2.2.29 -> 2.2.30 (stacked on #119)
Merge order
Stack for #115, squash one at a time from the bottom:
chore(ci): cancel the outdated run on a new PR push (2.2.26)chore(ci): PHPUnit + E2E nightly on main instead of on every push (2.2.27)perf(tests): precomputed fixture admin password hash (2.2.28)chore(ci): PHPUnit MariaDB on tmpfs without fsync (2.2.29)chore(ci): Playwright E2E as three parallel shards (2.2.30)perf(tests): fixture reset with DELETE instead of TRUNCATE (2.2.31)chore(ci): E2E dev image built with the gha cache (2.2.32)fix(e2e): password generator spec waits for the settings bounce (2.2.33)